from django.db import models
from realize.models.station import Station


class AirLineData(models.Model):
    origin_airport = models.CharField(max_length=30, verbose_name="起飞机场")
    destination_airport = models.CharField(max_length=30, verbose_name="目的机场")
    updated_at = models.DateTimeField(auto_now=True, verbose_name='观测时间')
    by_station = models.ForeignKey(Station, verbose_name="观测的台站", on_delete=models.CASCADE)
    location = models.CharField(max_length=100,verbose_name="检测到飞机的坐标")

    def __str__(self):
        return f"{self.origin_airport} - {self.destination_airport} - {self.updated_at}"

    class Meta:
        verbose_name_plural = '航线数据 - AirLineData'
